<template>
	<view class="max">
		<view class="max">
			<swiper class="max" :indicator-dots="indicatorDots" :autoplay="autoplay"
				:duration="duration" @change="cg">
				<swiper-item class="max">
					<view class="max cen">
						<img src="../../lib/img/img1.svg">
					</view>
				</swiper-item>
				<swiper-item class="max">
					<view class="max cen">
						<img src="../../lib/img/img2.svg">
					</view>
				</swiper-item>
				<swiper-item class="max">
					<view class="max cen">
						<img src="../../lib/img/img3.svg">
					</view>
				</swiper-item>
			</swiper>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				indicatorDots: true,
				autoplay: true,
				interval: 3000,
				duration: 500,
				timer:null
			}
		},
		methods: {
			cg(e) {
				if(e.detail.current == 2){
					this.timer=setTimeout(()=> {
						uni.redirectTo({
							url: '/pages/index/index'
						});
					}, 3000);
				}
			}
		},
		beforeDestroy() {
			clearTimeout(this.timer);
			this.timer=null
		}
	}
</script>

<style scoped>
	.max {
		height: 100%;
		width: 100%;
	}
	page {
		height: 100%;
		width: 100%;
	}
	img {
		height: 500upx;
		width: 500upx;
	}
	.cen {
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
	}
</style>